package com.bdqn.service.impl;

import com.bdqn.mapper.RecordMapper;
import com.bdqn.pojo.Record;
import com.bdqn.service.RecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class RecordServiceImpl implements RecordService {
    @Resource
    private RecordMapper recordMapper;
    @Override
    public List<Record> getRecordList(String goodsName, Long supplierId, Integer payStatus, Integer pageIndex, Integer pageSize) {
        pageIndex = (pageIndex-1)*pageSize;
        return recordMapper.getRecordList(goodsName,supplierId,payStatus,pageIndex,pageSize);
    }

    @Override
    public int recordCount(String goodsName, Long supplierId, Integer payStatus) {
        return recordMapper.recordCount(goodsName,supplierId,payStatus);
    }

    @Override
    public boolean recordAdd(Record record) {
        boolean f  = false;
        if (recordMapper.recordAdd(record) > 0){
            f = true;
        }
        return f;
    }

    @Override
    public Record recordLook(String id) {
        return recordMapper.recordLook(id);
    }

    @Override
    public boolean recordUpdate(Record record) {
        boolean f = false;
        if (recordMapper.recordUpdate(record) > 0){
            f = true;
        }
        return f;
    }

    @Override
    public boolean delRecord(Integer id) {
        boolean f = false;
        if (recordMapper.delRecord(id)>0){
            f = true;
        }
        return f;
    }
}
